package com.mszlu.blog.controller;

import com.mszlu.blog.service.CommentsService;
import com.mszlu.blog.vo.Result;
import com.mszlu.blog.vo.param.CommentParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * User: SJP
 * Date: 2022/3/2
 * Time: 19:39
 *
 * @author sjp
 * Description: No Description
 */
@RestController
@RequestMapping("comments")
public class CommentsController {
    @Resource
    private CommentsService commentsService;
    //comment/article/{id}
    @GetMapping("article/{id}")
    public Result comments(@PathVariable("id") Long id ){
        return commentsService.commentsByArticleId(id);
    }


    @PostMapping("create/change")
    public Result comment(@RequestBody CommentParam commentParam){
        return commentsService.comment(commentParam);
    }

}
